﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace LevenshteinDistance
{
    class Program
    {
        static void Main(string[] args)
        {
//             Console.WriteLine(Levenshtein.Distance("aunt", "ant"));
//             Console.WriteLine(Levenshtein.Distance("Sam", "Samantha"));
//             Console.WriteLine(Levenshtein.Distance("flomax", "volmax"));

            string str1 = "";
            string str2 = "";

            FileStream fs1 = new FileStream(@"D:\CodeSimilarity\Sample\TextDiff算法1.txt", FileMode.Open);
            StreamReader sr1 = new StreamReader(fs1);
            str1 = sr1.ReadToEnd();
            sr1.Close();
            fs1.Close();

            FileStream fs2 = new FileStream(@"D:\CodeSimilarity\Sample\TextDiff算法2.txt", FileMode.Open);
            StreamReader sr2 = new StreamReader(fs2);
            str2 = sr2.ReadToEnd();
            sr2.Close();
            fs2.Close();

            Console.WriteLine(Levenshtein.SimilarityDegree(str1, str2).ToString());

            Console.ReadLine();
        }
    }
}
